<?php
/**
 * CenterAction
 * 好友
 * Author: huqian
 * CreateDate: 2013-09-02
 */

class FriendAction extends CommonAction {
    //好友主页
    public function index() {
        $fid = intval($_GET['fid']); //好友的用户id
        if ($fid) {
            $User = M('user_base_info');
            $friend_info = $User->where("user_status = 2 and user_code = $fid")->find();
            if ($friend_info) {
                if (empty($friend_info['user_logo_add'])) {
                    if (empty($friend_info['api_logo_add'])) {
                        $user_logo_add = __PUBLIC__ . "/Uploads/Photo/default_160.png";
                    } else {
                        //如果是qq用户
                        if ($friend_info['user_reg_type'] == 3) {
                            $user_logo_add = str_replace('/40', '/100', $friend_info['api_logo_add']);
                        } else {
                            //新浪用户
                            $user_logo_add = str_replace('/50/', '/180/', $friend_info['api_logo_add']);
                        }
                    }
                } else {
                    $user_logo_add = __PUBLIC__ . "/Uploads/Photo/" . str_replace('_64', '_160', $friend_info['user_logo_add']);
                }
                $friend_info['user_logo_add'] = $user_logo_add;//真正的头像地址160*160的
            } else {
                //好友不存在或者好友账号已禁用
                $this->redirect('Index/index');
            }
        } else {
            //参数错误，跳转至首页
            $this->redirect('Index/index');
        }
        print_r($friend_info);
        $this->assign('title', $friend_info['user_nickname'] . '的主页 - ' . C('TITLE'));
        $this->assign('friend_info', $friend_info);
        $this->display();
    }
}

?>